<% error = @internal_transaction.error %>
<div class="tile tile-type-internal-transaction fade-in <%= if error, do: "tile-status--error--reason"%>" data-test="internal_transaction" data-key="<%= @internal_transaction.transaction_hash %>_<%= @internal_transaction.index %>" data-internal-transaction-transaction-hash="<%= @internal_transaction.transaction_hash %>" data-internal-transaction-index="<%= @internal_transaction.index %>">
  <div class="row tile-body">
    <!-- Color Block -->
    <div class="tile-transaction-type-block col-md-2 d-flex flex-row flex-md-column">
      <span class="tile-label">
        <%= gettext("Internal Transaction") %>
      </span>
      <span class="tile-status-label ml-2 ml-md-0" data-internal-transaction-type="<%= type(@internal_transaction) %>"><%= type(@internal_transaction) %></span>
      <%= if error do %>
        <span class="tile-status-label ml-2 ml-md-0"><%= gettext "Error" %>: <%= error %></span>
      <% end %>
    </div>
    <!-- Content -->
    <div class="col-md-7 col-lg-8 d-flex flex-column pr-2 pr-sm-2 pr-md-0">
      <%= render BlockScoutWeb.TransactionView, "_link.html", transaction_hash: @internal_transaction.transaction_hash %>
      <span class="text-nowrap">
        <%= @internal_transaction |> BlockScoutWeb.AddressView.address_partial_selector(:from, assigns[:current_address]) |> (&(if is_list(&1), do: Keyword.put(&1, :ignore_implementation_name, true), else: &1)).() |> BlockScoutWeb.RenderHelper.render_partial() %>
        &rarr;
        <%= @internal_transaction |> BlockScoutWeb.AddressView.address_partial_selector(:to, assigns[:current_address]) |> (&(if is_list(&1), do: Keyword.put(&1, :ignore_implementation_name, true), else: &1)).() |> BlockScoutWeb.RenderHelper.render_partial() %>
      </span>
      <span class="d-flex flex-md-row flex-column mt-3 mt-md-0">
        <span class="tile-title">
          <%= BlockScoutWeb.TransactionView.value(@internal_transaction, include_label: false) %> <%= Explorer.coin_name() %>
        </span>
      </span>
    </div>
    <!-- Block info -->
    <div class="col-md-3 col-lg-2 d-flex flex-row flex-md-column flex-nowrap justify-content-center text-md-right mt-3 mt-md-0">
      <span class="mr-2 mr-md-0 order-1">
        <%= link(
          gettext("Block #%{number}", number: to_string(@internal_transaction.block_number)),
          to: block_path(BlockScoutWeb.Endpoint, :show, @internal_transaction.block_number)
        ) %>
      </span>
      <span class="mr-2 mr-md-0 order-2" in-tile data-from-now="<%= @internal_transaction.transaction.block.timestamp %>"></span>
      <%= if assigns[:current_address] do %>
        <span class="mr-2 mr-md-0 order-0 order-md-3">
          <%= if assigns[:current_address].hash == @internal_transaction.from_address_hash do %>
            <span class="badge badge-danger tile-badge"><%= gettext "OUT" %></span>
          <% else %>
            <span class="badge badge-success tile-badge"><%= gettext "IN" %></span>
          <% end %>
        </span>
      <% end %>
    </div>
  </div>
</div>
